/*
 * @(#)ComonIndexNameTag.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.dms.taglib;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.struts.util.ResponseUtils;

import com.dcivision.dms.bean.DmsDefaultProfileSetting;

/**
 * Custom tag that print out a common index name
 *
 * @author  Lun Au
 * @company DCIVision Limited
 * @date    2007-05-04
 * @version $Revision: 1.1.2.1 $
 * @see     com.dcivision.dms.taglib.CommonIndexTag
 */
public class CommonIndexNameTag extends TagSupport {

  public static final String REVISION = "$Revision: 1.1.2.1 $";

  /**
   * Starts to render the common index name
   * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
   */
  public int doStartTag() throws JspException {
    CommonIndexTag indexTag = (CommonIndexTag)findAncestorWithClass(this, CommonIndexTag.class);
    DmsDefaultProfileSetting setting = (DmsDefaultProfileSetting)pageContext.getAttribute(indexTag.getId());
    ResponseUtils.write(pageContext, setting.getFieldName());
    return TagSupport.SKIP_BODY;
  }

  /**
   * The release method, clean up resources
   * @see javax.servlet.jsp.tagext.TagSupport#release()
   */
  public void release() {
    // TODO Auto-generated method stub
    super.release();
  }

  
}
